package com.demo.day410;

public class arr {

    public static void f1(){

        int[]  arr1 = {3,-10,21,3,1,24,245,64,67,67,56,4,5,-3,3};

        int max = arr1[0];

        for (int i = 1; i < arr1.length ; i++) {
            if (max<arr1[i]){
                max = arr1[i];
            }
        }
        System.out.println("最大值："+max);
    }

    public static void f2(){

        int[]  arr1 = {3,-10,21,3,1,24,245,64,67,67,56,4,5,-3,3};

        int min = arr1[0];

        for (int i = 1; i < arr1.length; i++) {
            if (min>arr1[i]){
                min = arr1[i];
            }
        }

        System.out.println("最小值："+min);
    }

    public static void f3(){

        int[]  arr1 = {3,-10,21,3,1,24,245,64,67,67,56,4,5,-3,3};



        int sum=arr1[0];

        for (int i = 1; i < arr1.length; i++) {
            sum = sum + arr1[i];
        }
        System.out.println("数组和值："+sum);
    }



    public static void main(String[] args) {
        f1();
        f2();
        f3();
    }
}